<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  let obj = {
    name: "老陈",
    say:function (){
      console.log(arguments);
      console.log(this.name);
      console.log(this);
    }
  }
  let obj2 = {
    name: "老王"
  }
  // 原生实现bind函数
  Function.prototype.myBind = function (objThis,...params) {
    // 保存当前调用函数this
    const thisFn = this
    let funcForBind = function (...secondParams) {
      const isNew = this instanceof funcForBind
      const thisArg  = isNew ? this : objThis;
      return thisFn.call(thisArg,...params,...secondParams)
    }
    funcForBind.prototype = Object.create(thisFn.prototype)
    return funcForBind
  }
  let sayClone2 = obj.say.myBind(obj2,1,2,3)
  sayClone2();
</script>
</body>
</html>